/**
 * @description JsonSchema表单，支持主从结构，通过定义JsonSchema 实现表单渲染
 */
Rsd.define('Rsd.zen.dialog.JsonFormDialog', {
    extend: 'Rsd.container.Dialog',
    requires: [
        'Rsd.widget.JsonForm', 
        'Rsd.container.Form'
    ],
    layout: 'fit',
    title:'Json数据查看器',
    height:750,
    width:1000,
    fieldWidth:'33%',
    items: [
        {
            xtype:'json-form',
            width:'100%',
            height:'100%',
            layout:{
                type:'hbox',
                content:'start start',
                wrap:'wrap'
            }
        }
    ],
    formSchema:null,
    /*
     * */
    constructor: function constructor(config) {

        config = config || {};
        this.apply(config);
        this.items[0].fieldWidth = this.fieldWidth;
    },

    /**
     * 
     * @param {*} data 
     * @param {*} include 
     * @returns 
     */
    load:function load(data)
    {
        var me = this;
        var _data = data||this.data;
        var schema = me.formSchema||{properties:Rsd.getJsonSchema(_data,me.include||[])};
        console.log('json view dialog schema is ',schema);
        this.items[0].loadFields(schema,function(s){
            //console.log(s);
            me.items[0].loadData(_data);
        });
         
        return this;
    }


},function (type) {


});